<?php
    //接受前端发送的数据
    $pro_name = $_GET["pro_name"];
    $pro_price = $_GET["pro_price"];
    $pro_imgpath = $_GET["pro_imgpath"];
    $pro_color = $_GET["pro_color"];
    $pro_size = $_GET["pro_size"];
    $pro_num = $_GET["pro_num"];
    $pro_status = $_GET["pro_status"];
    echo $pro_name;

    //连接数据库
    $db = new mysqli("localhost","root","123456","shopping_center");

    //设置添加sql语句
    $sql = "INSERT INTO products (pro_name,pro_price,pro_imgpath,pro_color,pro_size,pro_num,pro_status) VALUES ( '{$pro_name}','{$pro_price}','{$pro_imgpath}','{$pro_color}','{$pro_size}','{$pro_num}','{$pro_status}')";

    //执行sql语句
    $flag = $db->query($sql);

    //判断数据库操作是否成功
    if( $flag ){
        echo '{"ok":true}';
    }else{
        echo '{"ok":false}';
    }
?>